# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit flag-o-matic subversion

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~x86"

DESCRIPTION="Metadata backend library for use with Utopia Player"
SRC_URI=""
HOMEPAGE="http://code.google.com/p/utopiaplayer"
IUSE="debug doc"
RDEPEND=">=x11-libs/qt-4.2.3 \
		 doc? ( app-doc/doxygen ) \
		 !media-libs/utopiadb"
DEPEND="${RDEPEND} >=dev-util/cmake-2.4.6"

src_unpack() {

	built_with_use =x11-libs/qt-4* cups gif jpg mng png opengl mysql sqlite sqlite3 zlib

	if use debug; then
		built_with_use =x11-libs/qt-4* debug
	fi

	local repo_uri="http://utopiaplayer.googlecode.com/svn/trunk/utopiadb"

	subversion_fetch ${repo_uri}
}

src_compile() {
	local myconf="-DCMAKE_INSTALL_PREFIX=/usr"

	if use debug; then
		myconf="${myconf} -DCMAKE_BUILD_TYPE=Debug"
	else
		myconf="${myconf} -DCMAKE_BUILD_TYPE=Release"
	fi

	if use doc; then
		myconf="${myconf} -DBUILD_DOCS=ON"
	fi

	mkdir build
	cd build

	cmake ${myconf} -G "Unix Makefiles" .. || die

	make || die
}

src_install() {
	cd build

	make DESTDIR="${D}" install || die

	cd ..

	dodoc AUTHORS BUGS README TODO
}
